package com.smh.a04ThreadDemo4;

public class ThreadDemo1 {
    public static void main(String[] args) throws InterruptedException {

        //没有设置名字,也有默认名字
        MyThread myThread = new MyThread();
        MyThread myThread2 = new MyThread();
        MyThread myThread3 = new MyThread();
        myThread.start();
        myThread2.start();
        myThread3.start();

        //构造方法不能继承,但可以用super关键字调用
        MyThread myThread1 = new MyThread("cao");
        myThread1.start();
        //+


        Thread thread = Thread.currentThread();
        System.out.println(thread.getName());

        System.out.println("11111111111111");
        //哪个线程执行到,哪个就休眠.
        Thread.sleep(5000);
        System.out.println("11111111333333333333");
        for (int i = 0; i < 100; i++) {
            Thread.sleep(1000);
            System.out.println(i);
        }


    }

}
